﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>Ecology</title>
<!-- Stylesheets -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- Responsive -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link href="css/responsive.css" rel="stylesheet">
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--[if lt IE 9]><script src="js/respond.js"></script><![endif]-->
    <style>
        th{
            background-color: #bcbcbc;
            border: 1px #bcbcbc solid;
            text-align: center;
        }
        tr {
            padding: 0;
            margin: 0;
            border: 0;
        }
        td {
            padding: 0;
            margin: 0;
            width: 6%;
            font-size: 13px;
            text-align: center;
            border: 1px #8d8d8d solid;
        }
    </style>
    <script>
        function deleteMessage(id, pageNum) {
            if(confirm(`确定删除这条数据?`)) {
                $.ajax({
                    type: "GET",
                    url: `/deleteMessage?id=${id}&pageNum=${pageNum}`,
                    success: function (data) {
                        window.location.reload();
                    }
                });
            }
        };
    </script>
</head>

<body>
<div class="page-wrapper">
 	
    <!-- Preloader -->
    <div class="preloader"></div>
    
 	
    <!-- Main Header -->
    <header class="main-header">
    	<div class="top-bar">
        	<div class="top-container">
            	<!--Info Outer-->
                 <div class="info-outer">
                 	<!--Info Box-->
                    <ul class="info-box clearfix">
                        <li><a href="/user/logout">退出登录</a></li>
                        <li><a href="userCenterPage" th:text="${res.user.username}"></a></li>
                    </ul>
                 </div>
            </div>
        </div>
    	<!-- Header Upper -->
        <div class="header-upper">
            <div class="auto-container clearfix">
                <!-- Logo -->
                <div class="logo" style="width: 20%">
                    <a href="#"><img src="images/logo-1.png" alt="Ecology"></a>
                 </div>
                 
                 <!--Nav Outer-->
                <div class="nav-outer clearfix">
                    <!-- Main Menu -->
                    <nav class="main-menu">

                        <div class="navbar-header">
                            <!-- Toggle Button -->
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                        </div>

                        <div class="navbar-collapse collapse clearfix">
                            <ul class="navigation">
                                <li><a href="areaPage">管理土地</a></li>
                                <li><a href="cropTypePage">管理农作物种类</a></li>
                                <li><a href="uploadCropsPage">管理农作物</a></li>
                                <li><a href="seePage">实时监控</a></li>
                                <li><a href="medicinePage">植物农药管理</a></li>
                                <li><a href="#" style="color: #0F9E5E">通知公告</a></li>
                                <li><a href="searchAudit">用户审批</a></li>
                                <li><a href="userPage">人员管理</a></li>
                                <li><a href="userCenterPage">个人中心</a></li>
                            </ul>
                        </div>
                    </nav><!-- Main Menu End-->

                </div>
                
            </div>
        </div><!-- Header Top End -->
        
    </header><!--End Main Header -->


    <section class="donation-section">
        <div class="donation-form-outer">
<!--            <form form-group col-lg-6 col-md-6 col-xs-12 method="post" action="uploadCrops" enctype="multipart/form-data">-->
                <br>
                <!--Form Portlet-->
                <div class="form-portlet">
                    <h4>发布的信息</h4>
                    <div>
                        <div id="adddiv" class="theme-btn btn-style-two" style="float: right; border-radius: 5px; padding-top: 5px; padding-bottom: 5px;">
                            <a href="editMessage" style="color: #afd9ee;font-weight:bold">新增</a>
                        </div>
                    </div>
                    <br><br><br>
                    <table style="width: 100%; text-align: center">
                        <tr>
                            <th style="width: 10%;">
                                <div>
                                    <span>发布者</span>
                                </div>
                            </th>
                            <th style="width: 20%;">
                                <div>
                                    <span>发布时间</span>
                                </div>
                            </th>
                            <th style="width: 20%;">
                                <div>
                                    <span>发布内容</span>
                                </div>
                            </th>
                            <th style="width: 20%;">
                                <div>
                                    <span>已读人</span>
                                </div>
                            </th>
                            <th style="width: 20%;">
                                <div>
                                    <span>操作</span>
                                </div>
                            </th>
                        </tr>
                        <tr th:each="message, iterStat:${res.t.data}" th:class="'td' + ${iterStat.count % 2}">
                            <td style="width: 10%">
                                <div>
                                    <span th:text="${message.issuer}"></span>
                                </div>
                            </td>
                            <td style="width: 20%;">
                                <div>
                                    <span th:text="${message.issueTime}"></span>
                                </div>
                            </td>
                            <td style="width: 20%;">
                                <div>
                                    <span th:text="${message.message}"></span>
                                </div>
                            </td>
                            <td style="width: 20%;">
                                <div>
                                    <span th:text="${message.reader}"></span>
                                </div>
                            </td>
                            <td style="width: 20%;">
                                <a th:href="'editMessage?id=' + ${message.id}">编辑</a>
                                <input type="button" th:onclick="javascript:deleteMessage([[${message.id}]], [[${res.t.pageNum}]])" value="删除" />
                            </td>
                        </tr>
                    </table>
                </div>

                <br>
            <div>
                <div class="modal-footer no-margin-top">
                    <ul class="pagination pull-right no-margin">
                        <!-- 首页 -->
                        <li>
                            <a th:href="'/areaPage?pageNum=1'">首页</a>
                        </li>
                        <!-- 上一页 -->
                        <li>
                            <a th:href="'/areaPage?pageNum=' + ${res.t.jump(-1)}" th:text="上一页"></a>
                        </li>
                        <!-- 下一页 -->
                        <li>
                            <a th:href="'/areaPage?pageNum=' + ${res.t.jump(1)}" th:text="下一页"></a>
                        </li>

                        <!-- 尾页 -->
                        <li>
                            <a th:href="'/areaPage?pageNum=' + ${res.t.maxPage}">尾页</a>
                        </li>
                        <li>
                            <span th:text="'当前页：' + ${res.t.pageNum}"></span>
                        </li>
                        <li>
                            <span th:text="'页面大小：' + ${res.t.pageSize} + '条/页'"></span>
                        </li>
                        <li>
                            <span th:text="'总条数：' + ${res.t.size}"></span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </section>

    
</div>
<!--End pagewrapper-->


<!--Scroll to top-->
<div class="scroll-to-top scroll-to-target" data-target=".main-header"><span class="fa fa-long-arrow-up"></span></div>


<!--Donate Popup-->

<!-- /.modal -->

<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.fancybox.pack.js"></script>
<script src="js/jquery.fancybox-media.js"></script>
<script src="js/owl.js"></script>
<script src="js/wow.js"></script>
<script src="js/script.js"></script>
</html>
